<?php

/**
 * jishupu-cms
 * @Author:技术铺<jishupu@qq.com>
 * @Date: 2022/4/11
 */

namespace App\View\Components;

use Illuminate\View\Component;

/**
 * 静态框类
 * Class Modal
 * @package App\View\Components
 */
class Modal extends Component
{

    /**
     * id选择器名
     * @var
     */
    public $id = "";

    /**
     * class选择器名
     * @var
     */
    public $class = "";

    /**
     * 标题
     * @var string
     */
    public $title = "";

    /**
     * 提示内容
     * @var string
     */
    public $message = "";


    /**
     * 文本样式：success、error
     * @var string
     */
    public $textStyle = '';

    /**
     * 是否展示底部
     * @var bool|mixed
     */
    public $showFooter = false;


    /**
     * 取消按钮文本
     * @var string
     */
    public $cancelText = "取消";

    /**
     * 确定文本
     * @var string
     */
    public $okText = "确定";


    /**
     * Create a new component instance.
     *
     * @return void
     */
    public function __construct($id = "", $class = "", $title = "", $message = "", $textStyle = '', $showFooter = false, $cancelText = "", $okText = "")
    {
        $this->id = trim($id ?: $this->id);
        $this->class = $class ?: $this->class;
        $this->textStyle = $textStyle ?: $this->textStyle;
        $this->title = $title ?: __('common.reminder');
        $this->message = $message ?: $this->message;
        $this->showFooter = $showFooter ?? $this->showFooter;
        $this->cancelText = $cancelText ?: $this->cancelText;
        $this->okText = $okText ?: $this->okText;
    }

    /**
     * Get the view / contents that represent the component.
     *
     * @return \Illuminate\Contracts\View\View|\Closure|string
     */
    public function render()
    {
        return view('components.modal');
    }
}
